import java.net.*;

import server.*;

public class Main {
	public static void main(String[] args) throws InterruptedException {
		DatagramSocket sock = null;
		int port = 4000;
		MulticastSocket mcsock = null;
		try {
			System.out.println("Main");
			InetAddress group = InetAddress.getByName("234.1.1.1");
//			System.out.println(group);
			byte buf[] = new byte[200];
			buf = new String("END").getBytes();
			DatagramPacket pkt = new DatagramPacket(buf, buf.length,
					group, port);
			
			sock = new DatagramSocket();
			sock.send(pkt);
			

			mcsock = new MulticastSocket(port);
			mcsock.joinGroup(group);			
			mcsock.send(pkt);
			mcsock.leaveGroup(group);


		} catch (Exception e) {
			System.out.println(e);
			e.printStackTrace();
		} finally {
			sock.close();
			mcsock.close();
			
		}
	}
}
